﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _21thMayCTS
{
    class Student
    {
        private string fName;
        private string lName;
        private int sSN;
        private string address;
        private int phone;
        private string email;
        private int course;
        private Enums.Specialty specialty;
        private Enums.University university;
        private Enums.Faculty faculty;

        public Student(string fName, string lName, int sSN, string address, int phone, string email, int course, Enums.Specialty specialty, Enums.University university, Enums.Faculty faculty)
        {
            this.fName = fName;
            this.lName = lName;
            this.sSN = sSN;
            this.address = address;
            this.phone = phone;
            this.email = email;
            this.course = course;
            this.specialty = specialty;
            this.university = university;
            this.faculty = faculty;
        }
        
        public string FName
        {
            get
            {
                return fName;
            }
            set
            {
                fName = value;
            }
        }

        public string LName
        {
            get
            {
                return lName;
            }
            set
            {
                lName = value;
            }
        }

        public int SSN
        {
            get
            {
                return sSN;
            }
            set
            {
                sSN = value;
            }
        }

        public string Address
        {
            get
            {
                return address;
            }
            set
            {
                address = value;
            }
        }

        public int Phone
        {
            get
            {
                return phone;
            }
            set
            {
                phone = value;
            }
        }

        public string Email
        {
            get
            {
                return email;
            }
            set
            {
                email = value;
            }
        }

        public int Course
        {
            get
            {
                return course;
            }
            set
            {
                course = value;
            }
        }

        public Enums.Specialty Specialties
        {
            get
            {
                return specialty;
            }
            set
            {
                specialty = value;
            }
        }

        public Enums.University University
        {
            get
            {
                return university;
            }
            set
            {
                university = value;
            }
        }

        public Enums.Faculty Faculty
        {
            get
            {
                return faculty;
            }
            set
            {
                faculty = value;
            }
        }

        public override bool Equals(object o)
        {
            Student second = o as Student;
            if (second == null)
                return false;
            if (second.FName == this.FName &&
               second.LName == this.LName &&
               second.SSN == this.SSN)
            {
                return true;
            }
            else
                return false;
        }

        public override int GetHashCode()
        {
            string hash = this.fName + "&" + this.lName + "&" + this.sSN.ToString();
            return hash.GetHashCode();
        }

        public override string ToString()
        {
            return this.fName + " " + this.lName + " " + this.sSN.ToString();
        }

        public static bool operator ==(Student first, Student second)
        {
            if (Object.ReferenceEquals(first, null) && Object.ReferenceEquals(second, null))
                return true;
            if (Object.ReferenceEquals(first, null) || Object.ReferenceEquals(second, null))
                return false;

            return first.Equals(second);
        }

        public static bool operator !=(Student first, Student second)
        {
            return !(first == second);
        }
        static void Main(string[] args)
        {
            Student firstStudent = new Student("Filip", "Slanchev", 89123545, "Sofia", 
                123345, "filip", 3, Enums.Specialty.InformationSystem, Enums.University.SofiaUniversity, Enums.Faculty.FMI);
            Student secondStudent = new Student("Filip", "Slanchev", 89123545, "Sofia",
                123345, "filip", 3, Enums.Specialty.InformationSystem, Enums.University.SofiaUniversity, Enums.Faculty.CSF);

            bool test = firstStudent.Equals(secondStudent);
            Console.WriteLine(test);
            Console.WriteLine(firstStudent);

            Console.WriteLine(firstStudent==secondStudent);
        }
    }
}
